<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/3/15
 * Time: 10:19
 */

echo "<title>8-4 可变函数</title>";
echo "<p style='text-align: center'><a href=\"index.php\"><font size=\"4\">目录</font></a></p>";
header("Content-type: text/html; charset=utf-8");
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";

function func(){
    echo 'my function called';
}
$name = 'func';
//调用可变函数
$name();
echo "<br />";

//对象的方法上调用可变函数
class book{
    function getName(){
        return 'bookname';
    }
}
$func = 'getName';
$book = new book();
$book ->$func();

print_r($func);

